home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue56 / Alfresco / TstCopyu.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-03-01  |  952 b   |  53 lines

  1. unit TstCopyu;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Button1: TButton;
  12.     edSourceFile: TEdit;
  13.     edDestFile: TEdit;
  14.     Label1: TLabel;
  15.     Label2: TLabel;
  16.     procedure Button1Click(Sender: TObject);
  17.   private
  18.     { Private declarations }
  19.   public
  20.     { Public declarations }
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. uses
  29.   AAThdCpy;
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TForm1.Button1Click(Sender: TObject);
  34. var
  35.   File1 : TFileStream;
  36.   File2 : TFileStream;
  37. begin
  38.   File1 := nil;
  39.   File2 := nil;
  40.   try
  41.     Button1.Enabled := false;
  42.     File1 := TFileStream.Create(edSourceFile.Text, fmOpenRead + fmShareDenyNone);
  43.     File2 := TFileStream.Create(edDestFile.Text, fmCreate);
  44.     AAThreadedCopyStream(File1, File2);
  45.   finally
  46.     File1.Free;
  47.     File2.Free;
  48.     Button1.Enabled := true;
  49.   end;
  50. end;
  51.  
  52. end.
  53.